package A2;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * <p>Title: Class to handle the Widget table in the db</p>
 * <p>Description: CS 343 Assignment #2</p>
 * @author Mike Harmon
 * @author Erik Olson
 * @author Casey Golla
 * @author Jack Freiermuth
 * @email michael.harmon@my.uwrf.edu
 * @email erik.olson@my.uwrf.edu
 * @email casey.golla@my.uwrf.edu
 * @email jack.freiermuth@my.uwrf.edu
 * @date November 4th 2013
 * @team 5
 */
@Entity
public class Widget {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;
	private String description;
	private String name;
	private static int quantity = 0;

	/**
	 * Default constructor
	 */
	public Widget() {
		description = null;
		name = null;
		quantity = 0;
	}

	/**
	 * 
	 * @param in_descrip
	 * @param in_name
	 */
	public Widget( String in_name, String in_descrip ) {
		description = in_descrip;
		name = in_name;
		quantity++;
	}

	/**
	 * Function to get id
	 * @return id : long
	 */
	public long getID() {
		return id;
	}

	/**
	 * Function to get the description
	 * @return description : string
	 */
	public String getDescription() {
		return this.description;
	}

	/**
	 * Function to set the description
	 * @param in_descript
	 */
	public void setDescription(String in_descript) {
		description = in_descript;
	}

	/**
	 * Function to get the name
	 * @return name : String
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Function to set the name
	 * @param in_name
	 */
	public void setName(String in_name) {
		name = in_name;
	}

	@Override
	public String toString() {
		return "[Widget name: " + name + ", description: " + description + " ]";
	}

	public int getQuantity() {
		return this.quantity;
	}

}